<script setup lang="ts">
import Promoter from './nodes/Promoter.vue';
import Approver from './nodes/Approver.vue';
import Send from './nodes/Send.vue';
import Branch from './nodes/Branch.vue';
import { AddNodeType, ENodeType } from './types';

const model = defineModel<AddNodeType>({ default: {} });
</script>

<template>
	<Promoter v-if="model.type === ENodeType.PROMOTER" v-model="model" />
	<Approver v-if="model.type === ENodeType.APPROVER" v-model="model" />
	<Send v-if="model.type === ENodeType.SEND" v-model="model" />
	<Branch v-if="model.type === ENodeType.BRANCH" v-model="model">
		<template v-slot="slot">
			<node-wrap v-if="slot.node" v-model="slot.node.childNode"></node-wrap>
		</template>
	</Branch>

	<node-wrap v-if="model.childNode" v-model="model.childNode"></node-wrap>
</template>

<style lang="scss" scoped></style>
